package vn.mta.nht.mock.common.vo;

import java.util.ArrayList;
import java.util.List;

import vn.mta.nht.mock.common.utils.StringUtils;
import vn.mta.nht.mock.entity.Premise;

/**
 * author:TruongNH.(nguyenhuutruong.20111991@gmail.com) created date: Dec 21,
 * 2014 version: 1.0
 */
public class PremiseVO {
	// All property of Object
	private int preId;
	private String[] accreditations;
	private String[] jspOffices;
	private String mediaContactName;
	private String cateringContact;
	private String cateringType;
	private String[] localDemographicIssues;
	private String localDemographicNotes;
	private String iS_Network;
	private String clientITFacilitiesDetails;
	private String[] outreachLocation;
	private String[] localHotel;
	private String hostingContact;
	private String visitorParkingSpaces;
	private String visitorParkingAlternative;

	// All method getter and setter of Object
	public int getPreId() {
		return preId;
	}

	public void setPreId(int preId) {
		this.preId = preId;
	}

	public String[] getAccreditations() {
		return accreditations;
	}

	public void setAccreditations(String[] accreditations) {
		this.accreditations = accreditations;
	}

	public String[] getJspOffices() {
		return jspOffices;
	}

	public void setJspOffices(String[] jspOffices) {
		this.jspOffices = jspOffices;
	}

	public String getMediaContactName() {
		return mediaContactName;
	}

	public void setMediaContactName(String mediaContactName) {
		this.mediaContactName = mediaContactName;
	}

	public String getCateringContact() {
		return cateringContact;
	}

	public void setCateringContact(String cateringContact) {
		this.cateringContact = cateringContact;
	}

	public String getCateringType() {
		return cateringType;
	}

	public void setCateringType(String cateringType) {
		this.cateringType = cateringType;
	}

	public String[] getLocalDemographicIssues() {
		return localDemographicIssues;
	}

	public void setLocalDemographicIssues(String[] localDemographicIssues) {
		this.localDemographicIssues = localDemographicIssues;
	}

	public String getLocalDemographicNotes() {
		return localDemographicNotes;
	}

	public void setLocalDemographicNotes(String localDemographicNotes) {
		this.localDemographicNotes = localDemographicNotes;
	}

	public String getiS_Network() {
		return iS_Network;
	}

	public void setiS_Network(String iS_Network) {
		this.iS_Network = iS_Network;
	}

	public String getClientITFacilitiesDetails() {
		return clientITFacilitiesDetails;
	}

	public void setClientITFacilitiesDetails(String clientITFacilitiesDetails) {
		this.clientITFacilitiesDetails = clientITFacilitiesDetails;
	}

	public String[] getOutreachLocation() {
		return outreachLocation;
	}

	public void setOutreachLocation(String[] outreachLocation) {
		this.outreachLocation = outreachLocation;
	}

	public String[] getLocalHotel() {
		return localHotel;
	}

	public void setLocalHotel(String[] localHotel) {
		this.localHotel = localHotel;
	}

	public String getHostingContact() {
		return hostingContact;
	}

	public void setHostingContact(String hostingContact) {
		this.hostingContact = hostingContact;
	}

	public String getVisitorParkingSpaces() {
		return visitorParkingSpaces;
	}

	public void setVisitorParkingSpaces(String visitorParkingSpaces) {
		this.visitorParkingSpaces = visitorParkingSpaces;
	}

	public String getVisitorParkingAlternative() {
		return visitorParkingAlternative;
	}

	public void setVisitorParkingAlternative(String visitorParkingAlternative) {
		this.visitorParkingAlternative = visitorParkingAlternative;
	}

	
	public Premise converter(PremiseVO preVo) {

		Premise pre = new Premise();
		pre.setAccreditations(StringUtils
				.convertArr2String(accreditations, ","));
		pre.setCateringContact(preVo.getCateringContact());
		pre.setCateringType(preVo.getCateringType());
		pre.setClientITFacilitiesDetails(preVo.getClientITFacilitiesDetails());
		pre.setHostingContact(preVo.getHostingContact());
		pre.setiS_Network(preVo.getiS_Network());
		pre.setJspOffices(StringUtils.convertArr2String(jspOffices, ","));
		pre.setLocalDemographicIssues(StringUtils.convertArr2String(
				localDemographicIssues, ","));
		pre.setLocalDemographicNotes(preVo.getLocalDemographicNotes());
		pre.setLocalHotel(StringUtils.convertArr2String(localHotel, ","));
		pre.setMediaContactName(preVo.getMediaContactName());
		pre.setOutreachLocation(StringUtils.convertArr2String(outreachLocation,
				","));
		pre.setVisitorParkingAlternative(preVo.getVisitorParkingAlternative());
		pre.setVisitorParkingSpaces(preVo.getVisitorParkingSpaces());
		return pre;
	}

	// Convert Premise to PremiseVO
	public PremiseVO converterEntity2VO(Premise pre) {

		PremiseVO preVO = new PremiseVO();
		preVO.setAccreditations(StringUtils.convertString2Array(pre
				.getAccreditations().trim(), ","));
		preVO.setCateringContact(pre.getCateringContact());
		preVO.setCateringType(pre.getCateringType());
		preVO.setClientITFacilitiesDetails(pre.getClientITFacilitiesDetails());
		preVO.setHostingContact(pre.getHostingContact());
		preVO.setiS_Network(pre.getiS_Network());
		preVO.setJspOffices(StringUtils.convertString2Array(pre.getJspOffices()
				.trim(), ","));
		preVO.setLocalDemographicIssues(StringUtils.convertString2Array(pre
				.getLocalDemographicIssues().trim(), ","));
		preVO.setLocalDemographicNotes(pre.getLocalDemographicNotes());
		preVO.setLocalHotel(StringUtils.convertString2Array(pre.getLocalHotel()
				.trim(), ","));
		preVO.setMediaContactName(pre.getMediaContactName());
		preVO.setOutreachLocation(StringUtils.convertString2Array(pre
				.getOutreachLocation().trim(), ","));
		preVO.setVisitorParkingAlternative(pre.getVisitorParkingAlternative());
		preVO.setVisitorParkingSpaces(pre.getVisitorParkingSpaces());
		return preVO;
	}

	// Convert preList to preVOList
	public List<PremiseVO> converterListEntity2VO(List<Premise> preList) {
		List<PremiseVO> preListVO = new ArrayList<PremiseVO>();
		for (Premise pre : preList) {
			preListVO.add(this.converterEntity2VO(pre));
		}
		return preListVO;
	}
}
